#!/usr/bin/env bash
# Copyright (c) 2024 maminjie <canpool@163.com>
# SPDX-License-Identifier: MulanPSL-2.0

readonly CUR_DIR=$(dirname $(readlink -f "$0"))

readonly SHCANPOOL_DIR="$CUR_DIR/.."

# config $HOME/bin
# echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
BIN_DIR="$HOME/bin"
if [ ! -d $BIN_DIR ]; then
    mkdir -p $BIN_DIR
fi
ln -snf $SHCANPOOL_DIR/projects/ola/ola.sh $BIN_DIR/ola
command -v ola > /dev/null
if [ $? -ne 0 ]; then
    echo 'export PATH="$BIN_DIR:$PATH"' >> ~/.bashrc
    echo "Please in terminal exec command: source ~/.bashrc"
fi

# init config files
cp $CUR_DIR/conf/{.vimrc,.tmux.conf} $HOME

bash $SHCANPOOL_DIR/projects/ola/ola.sh init
bash $SHCANPOOL_DIR/projects/ola/ola.sh git alias

